package com.ars.common.dao;

import com.ars.common.beans.User.User;
import com.ars.common.utils.DBUtil;

import java.sql.PreparedStatement;
import java.sql.SQLException;

public class UpdateUserInfo {
    public static boolean updateUserInfo(User user,String id) throws SQLException
    {
        String sql = "update user set password = ?,phone = ?,sex = ?,name = ?,mailbox = ?,userID = ? where userID = ?";
        PreparedStatement ps = DBUtil.getConnection().prepareStatement(sql);
        ps.setString(1,user.getPassword());
        ps.setString(2,user.getPhone());
        ps.setString(3,user.getSex());
        ps.setString(4,user.getName());
        ps.setString(5,user.getMailbox());
        ps.setString(6,user.getUserID());
        ps.setString(7,id);

        if(ps.executeUpdate() == 1)
        {
            return true;
        }
        else
        {
            return false;
        }


    }
}
